﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="LocalizedStringLengthAttribute.shared.cs" company="Spenta Consulting">
//   (c) Copyright 2011
// </copyright>
// <summary>
//   Extends the StringLengthAttribute type to provide a custom message to the user
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Spenta.StreetCare.Core.Shared.Attributes
{
    using System.ComponentModel.DataAnnotations;

    /// <summary>
    /// Extends the StringLengthAttribute type to provide a custom message to the user
    /// </summary>
    public class LocalizedStringLengthAttribute : StringLengthAttribute
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="LocalizedStringLengthAttribute"/> class.
        /// </summary>
        /// <param name="maximumLength">The maximum length of a string.</param>
        public LocalizedStringLengthAttribute(int maximumLength)
            : base(maximumLength)
        {
            ErrorMessageResourceName = "StringLength_ValidationError";
            ErrorMessageResourceType = typeof(Silverlight.Resources.Spenta_StreetCare_Core);
        }
    }
}
